package com.jketing.controller.ams.sys;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.jketing.controller.BaseController;
import com.jketing.entity.ams.sys.Operation;
import com.jketing.service.ams.sys.OperationService;

/**
 * Controller 请求处理
 * 
 * @author  李荣华
 * @version v1.0
 * @date    2017-08-19
 * @since   Spring-mvc 4.3.8
 */
@Controller
//@SessionAttributes(value={"operation_flag","operation_query","operation_order","operation_page"})
@RequestMapping("/operation")
public class OperationController extends BaseController<Operation,String>{

	/**
	 *  service 自动注入服务层操作实例
	 */
	@Autowired
	public void setService(OperationService service) {
		super.setBaseService(service);
	}
	
	@Override
	protected String getPrefixPath() {
		return "sys/operation/";
	}

	@Override
	protected String getQueryMode() {
		return "Entity";
	}
	
	@Override
	protected Operation getQuery(Operation query) {
		String type = (String)getSession().getAttribute("operation_type");
		if("redirect".equals(type)) {			
			if("Entity".equals(getQueryMode())) {
				query = (Operation)getSession().getAttribute("operation_query");
			}
		}
		//可在此处增加修改查询条件的代码
		return query;
	}
}
